package com.hex.ds.hdtp.core.app.license.activation.service.impl;

import com.hex.ds.hdtp.core.app.license.activation.converter.IFuncActivationLogConverter;
import com.hex.ds.hdtp.core.app.license.activation.dto.request.FuncActivationLogRequestDto;
import com.hex.ds.hdtp.core.app.license.activation.service.IFuncActivationLogService;
import com.hex.ds.hdtp.core.inf.license.activation.repository.IFuncActivationLogRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor(onConstructor_ = {@Lazy, @Autowired})
public class FuncActivationLogService implements IFuncActivationLogService {

    private final IFuncActivationLogRepository funcActivationLogRepository;

    private final IFuncActivationLogConverter converter;


    @Override
    public void add(FuncActivationLogRequestDto funcActivationLogRequestDto) {
        if (funcActivationLogRepository.add(converter.toFuncActivationLogPo(funcActivationLogRequestDto)) != 1) {
            throw new RuntimeException("新增license激活记录失败");
        }
    }
}
